package cn.demo.pm.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.core.constant.SqlOperator;
import com.mybatisflex.core.query.SqlOperators;
import cn.demo.common.mybatisFlex.MyInsertListener;
import cn.demo.common.mybatisFlex.MyUpdateListener;
import cn.demo.common.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnore;
import cn.demo.common.core.domain.BaseEntity;
/**
 * 积分账单对象 pm_integral_bill
 *
 * @author xtjun
 * @date 2024-06-03
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(value = "pm_integral_bill",onInsert = MyInsertListener.class,onUpdate = MyUpdateListener.class)
public class PmIntegralBill extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "id")
    private String id;

    @Excel(name = "用户id")
    @Schema(description = "用户id")
    private String userId;

    @Excel(name = "账单名称")
    @Schema(description = "账单名称")
    private String billName;

    @Excel(name = "账单类型", dictType = "pm_bill_type")
    @Schema(description = "账单类型(字典:pm_bill_type)")
    private Integer billType;

    @Excel(name = "关联id")
    @Schema(description = "关联id")
    private String linkId;

    @Excel(name = "积分")
    @Schema(description = "积分")
    private Long integral;

    @Excel(name = "总积分")
    @Schema(description = "总积分")
    private Long integralTotal;

    @Excel(name = "部门id")
    @Schema(description = "部门id")
    private String deptId;

    // 自定义字段的 SQL 操作符
    @JsonIgnore
    public static final SqlOperators operators = new SqlOperators() {{
        set(PmIntegralBill::getUserId, SqlOperator.EQUALS);
        set(PmIntegralBill::getBillName, SqlOperator.LIKE);
        set(PmIntegralBill::getBillType, SqlOperator.EQUALS);
        set(PmIntegralBill::getLinkId, SqlOperator.EQUALS);
        set(PmIntegralBill::getIntegral, SqlOperator.EQUALS);
        set(PmIntegralBill::getIntegralTotal, SqlOperator.EQUALS);
        set(PmIntegralBill::getDeptId, SqlOperator.EQUALS);
    }};
}
